package com.dly.blog.queue;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RDelayedQueue;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
@RequiredArgsConstructor
@Slf4j
public class OverdueFileQueue {

    /**
     * The Delayed queue.
     */
    private final RDelayedQueue<String> fileDelayedQueue;


    /**
     * Add order.
     *
     * @param orderNo the order no
     */
    public void addFile(final String orderNo, Integer timer) {
        //加入队列
        fileDelayedQueue.offer(orderNo, timer, TimeUnit.SECONDS);
    }
}